//https://leetcode.cn/problems/remove-duplicates-from-sorted-array/
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int n = nums.size();
        if(n == 0) {
            return 0;
        }
        int fast = 0, slow = 1;
        while (fast < n - 1) {
            if (nums[fast] != nums[fast + 1]) {
                nums[slow] = nums[fast + 1];
                slow ++;
            }
            fast ++;
        }
        return slow;
    }
};